//
//  BasicViewController.m
//  WorkNest
//
//  Created by Billy on 15/7/3.
//  Copyright (c) 2015年 nest. All rights reserved.
//

#import "BasicViewController.h"

@interface BasicViewController ()


@end

@implementation BasicViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    
    
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    
    if (self){
        
        UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0,35, 35)];
        [backButton addTarget:self action:@selector(backToPreviousPage) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *barButton_back = [[UIBarButtonItem alloc] initWithCustomView:backButton];
        
        UIImageView *imageView=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"newBack"]];
        imageView.frame=CGRectMake(0, 8,14, 20);
        [backButton addSubview:imageView];
        
        [self.navigationItem setLeftBarButtonItem:barButton_back];
    }
    
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view setBackgroundColor:[UIColor whiteColor]];

    
    if (SYSTEM_VERSION >= 7.0) {
        
        [self setEdgesForExtendedLayout:UIRectEdgeNone];
        [self.navigationController.navigationBar setBarTintColor:[Util colorWithHexString:@"#47BDF2"]];
        
    }else{
        
        [self.navigationController.navigationBar setTintColor:[Util colorWithHexString:@"#47BDF2"]];
    }
    
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];

}


- (void) viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO];
}
- (void) backToPreviousPage {
//    
//    CATransition *transition = [CATransition animation];
//    
//    transition.duration = 0.3f;
//    
//    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
//    
//    transition.type = @"push";
//    transition.subtype = kCATransitionFromBottom;
//    
//    transition.delegate = self;
//    
//    [self.view.superview.layer addAnimation:transition forKey:nil];
    
    
    [self.navigationController popViewControllerAnimated:YES];
}




@end
